<!DOCTYPE html>
<html>
<head>
    <title>${sysEn}-配件</title>
     <#include "/common/com_edit_css.ftl" >
</head>
<body>
    <div class="wrapper wrapper-content fadeInRight commoneditpage">
        <div class="row">
            <div class="col-lg-8 m-auto">
                <div class="ibox ">
                    <div class="ibox-title">
                        <h5>${actNm}-配件</h5>
                    </div>
                    <div class="ibox-content">
                        <form id="form" action="${ctx}/parts_info_edit_submit.do" method="post">
                            <input type="hidden" name="id" id="id" value="${obj.id?c}">
                            <div class="form-group row"><label class="col-lg-2 col-form-label must">配件名称：</label>
                                <div class="col-lg-10">
                                    <input type="text" placeholder=""
                                           value="${obj.partsName}"
                                           id="partsName" name="partsName" class="form-control"
                                           data-easyform="length:1 50;"
                                           data-message="配件名称为长度[1-50]字符"
                                       />
                                </div>
                            </div>
                            <div class="form-group row"><label class="col-lg-2 col-form-label must">配件类别：</label>
                                <div class="col-lg-10">
                                    <select class="form-control m-b" name="categoryId" id="categoryId">
                                        <#list categoryList as p>
                                         <#if p.id == obj.categoryId >
                                            <option value="${p.id}" selected="selected">${p.categoryName}</option>
                                         <#else>
                                           <option value=${p.id}>${p.categoryName}</option>
                                         </#if>
                                        </#list>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label">排序：</label>
                                <div class="col-lg-4">
                                    <input type="text" placeholder="排序"
                                           id="sort"
                                           value="${obj.sort}"
                                           name="sort" data-easyform="null;number;"
                                           data-message-number="请输入数字"
                                           class="form-control col-lg-12" />
                                </div>
                                <div class="col-lg-4"><label class="col-lg-12" style="color:red" >(当前最大的排序是:${maxSort})</label></div>
                            </div>
                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label must">产品简述：</label>
                                <div class="col-lg-10">
                                    <textarea placeholder="" id="remarks"
                                           name="remarks" data-easyform="null;length:1 4000;"
                                           data-message="产品简述为长度[1-2000]字符"
                                           class="form-control" >${obj.remarks }</textarea>
                                </div>
                            </div>
                            
                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label must">优势特点：</label>
                                <div class="col-lg-10">
                                    <textarea placeholder="" id="superior" height="200"
                                           name="superior" data-easyform="null;length:1 4000;"
                                           data-message="优势特点为长度[1-2000]字符"
                                           class="form-control" >${obj.superior }</textarea>
                                </div>
                            </div>
                            
                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label must">维修保养：</label>
                                <div class="col-lg-10">
                                    <textarea placeholder="" id="maintain" height="200"
                                           name="maintain" data-easyform="null;length:1 4000;"
                                           data-message="维修保养为长度[1-2000]字符"
                                           class="form-control" >${obj.maintain }</textarea>
                                </div>
                            </div>
                            <div class="form-group row">
                                <label class="col-lg-2 col-form-label">是否启用：</label>
                                <div class="col-lg-10 text-left ">
                                    <div class="i-checks">
                                        <label class="">
                                            <div class="icheckbox_square-green" style="position: relative;">
                                                <input data-easyform="null;" name="status" id="status" type="checkbox" <#if obj.status == 1>checked</#if>  style="position: absolute; opacity: 0;" >
                                                <ins class="iCheck-helper" style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
                                            </div>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <@filer_tag attrNm="imageUrl"  titleLabelNm="图片上传" previewLabelNm="图片预览"  pWidth="300"  domain="${imgdomain}" url="${imageUrls}" withtext="0" multifiles="1" params="typeId=7&key=imageUrl"></@filer_tag>
                            <@filer_tag attrNm="vedioUrl" titleLabelNm="视频上传"   pWidth="400"  domain="${imgdomain}" withpreview="0" accpet=".mp4,.ogg,.webm" url="${vedioUrl}" params="typeId=7&key=vedioUrl"></@filer_tag>
                            <@filer_tag attrNm="viewImageUrl" titleLabelNm="视频封面上传" previewLabelNm="视频封面预览"  pWidth="400"  domain="${imgdomain}" url="${viewImageUrl}" params="typeId=7&key=viewImageUrl"></@filer_tag>
                            <div class="form-group row ">
                                <div class="col-lg-offset-2 col-lg-10">
                                    <button class="btn btn-sm btn-primary" type="button" id="signBtn" tg="ensure">确定</button>
                                    <button class="btn btn-sm btn-white" type="button" id="cancelBtn" tg="cancel">取消</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <#include "/common/com_edit_js.ftl">
    <script type="text/javascript">
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
        $(document).ready(function () {
            EditPager.init({
                container:$("#form"),
                param:function () {
                    var id = $("#id").val();
                    var obj = {
                        id:id?id:0,
                        partsName:$("#partsName").val(),
                        categoryId:$("#categoryId").val(),
                        sort:$("#sort").val(),
                        status:$("#status").prop("checked")?1:0,
                        remarks:$("#remarks").val(),
                        superior:$("#superior").val(),
                        maintain:$("#maintain").val()
                    };
                    var imgs = $("#imageUrl_manager").filesManger().getVal();
                    if(imgs && imgs.length >0){
                        for(var i=0;i<imgs.length;i++){
                            obj["imageList[" + i +"].imageUrl"] = imgs[i];
                            obj["imageList[" + i +"].partsInfoId"] = id;
                        }
                    }
                    var vedio = $("#vedioUrl_manager").filesManger().getVal();
                    var vedioImg = $("#viewImageUrl_manager").filesManger().getVal();
                    if(vedio || vedioImg){
                        if(vedioImg){
                            obj["vedioList[0].imageUrl"] = vedioImg;
                        }
                        if(vedio){
                            obj["vedioList[0].vedioUrl"] = vedio;
                        }
                        obj["vedioList[0].partsInfoId"] = id;
                    }
                    return obj;
                }
            });
        });

    </script>
</body>
</html>
